package com.ruoyi.activity.enumuration;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * 红包分析枚举类型
 * @author chengjian 
 * @date 2021/9/14
 */
@AllArgsConstructor
@Getter
@NoArgsConstructor
public enum RedPacketRecordViewEnum {
    /**
     * 枚举范围
     */
    TOTAL(1,"红包金额"),
    GAIN(2,"领取金额"),
    SURPLUS(3,"未抢完金额"),
    LIVE_CHANNEL(4,"发红包的直播间数量");

    private Integer option;
    private String label;

    public static String getLabelName(Integer option){
        if (option == null){
            return null;
        }

        for (RedPacketRecordViewEnum viewEnum: RedPacketRecordViewEnum.values()){
            if (viewEnum.option.equals(option)){
                return viewEnum.label;
            }
        }

        return null;
    }

    public static List<String> getOptionsLabel(){
        List<String> strings = new ArrayList<>(6);
        for (RedPacketRecordViewEnum viewEnum: RedPacketRecordViewEnum.values()){
            if (viewEnum.option == 4){
                continue;
            }
            strings.add(viewEnum.label);
        }

        return strings;
    }
}
